package ar.edu.itba.ia2010.geneticos.motor.api.sintaxistree.impl;

import java.util.Iterator;

import org.apache.commons.lang.Validate;

/**
 * Iterador read-only 
 * 
 * @author Juan F. Codagnone
 * @since Mar 28, 2010
 * @param <T> t
 */
public class ReadOnlyIterator<T> implements Iterator<T> {
    private final Iterator<T> target;

    /** Creates the ReadOnlyIterator. */
    public ReadOnlyIterator(final Iterator<T> target) {
        Validate.notNull(target);
        
        this.target = target;
    }
    
    /** @see Iterator#hasNext() */
    public final boolean hasNext() {
        return target.hasNext();
    }

    /** @see Iterator#next() */
    public final T next() {
        return target.next();
    }

    /** @see Iterator#remove() */
    public final void remove() {
        throw new IllegalStateException();
    }
}